<?php
namespace ctrl\demo;

use Sdk\Edayun\callEdaYunApiUtil;

class edayun
{
    //获取仓库列表 http://ec.com/?c=demo_edayun&a=warehouseList
    public static function warehouseList()
    {
        $action = '/listPublicWarehouseInfo';
        $data = [];
        $result = callEdaYunApiUtil::callEdaYunApi($action, 'POST', $data);
        echo '<pre />';
        print_r($result);
    }

    //易达云 http://ec.com/?c=demo_edayun&a=pull
    public static function pull()
    {
        \serv\task\warehouse\edayun::pull();
    }

    //获取拉取谷仓库存列表 http://ec.com/?c=demo_edayun&a=pullQueue
    public static function pullQueue()
    {
        $string = '{"warehouse_id":"172","warehouse_code":"121"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\edayun::pull($data);
        var_dump($result);
    }

    //更新或锁 //http://ec.com/?c=demo_edayun&a=stock
    public static function stock()
    {
        $string = '{"productSku":"A0000209C-KDA","productName":"Chair accessories - Hardware body","warehouseName":"加东5仓","actualInvQuantity":41,"invLockQuantity":4,"salableQuantity":37,"nonSalableQuantity":0,"inTransitQuantity":136,"barCode":"R17530675526","extraBarcode1":"","warehouseId":"121","warehouseCode":"CAYYZ-F005","countryCode":"CA","warehouse_id":"172"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\edayun::check($data);
        var_dump($result);
    }

}